#!/bin/bash

set -eo pipefail
shopt -s inherit_errexit nullglob

i=0
pkg="$PKG"
until [ $i -gt 10 ]
do
  echo "Checking for $pkg in npm registry ($((i+1))/10)"
  info=$(npm info $pkg)
  if [[ "$info" != "" ]]; then
    echo "Found."
    break
  fi

  i=$((var+1))
  sleep 15s
done